<?php
declare (strict_types=1);

namespace app\service;


use think\facade\Log;

class RedisClusterService
{
    public static function run(): ?\RedisCluster
    {
        try {
            return new \RedisCluster(null, [
                '127.0.0.1:6380',
                '127.0.0.1:6381',
                '127.0.0.1:6382',
                '127.0.0.1:6383',
                '127.0.0.1:6384',
                '127.0.0.1:6385',
            ], 3, 3, true);
        } catch (\RedisClusterException $e) {
            Log::write("[redis-cluster]连接错误：" . $e->getMessage(), 'error');
            return null;
        }
    }
}
